$(function(){
    //一级菜单TAB切换
    $(".top-menu-left ul li").click(function(){
        $(this).removeClass("tab-no-select");
        $(this).addClass("tab-select").siblings().removeClass("tab-select");
        $(this).siblings().addClass("tab-no-select");

        //获取当前点击页签的的属性值
        var menu_id = $(this).attr("data-url");
        //点击加载树结构菜单
        createTree({menu_id: menu_id});
    });

    $('#logout').click(function(){
        window.location.href="homePage";
    });

    //待办事项更多

    $('#toDoListmore').click(function(){
        var layoutId = $(this).parent().parent().attr('id');
        var url = $(this).parent().parent().attr('data-interface');
        $('#iframeModal').attr('data-layoutId',layoutId);
        $('#iframeModal').attr('data-interface',url);
        $('#iframeModal').attr('src','todoWorkList');
        $('#myModal .modal-header .modal-title').html('待办事项');
        $('#myModal').modal();
    });

    //左侧菜单隐藏

    $('.top-more-icon').click(function(){
        var display = $('.left-content ').css('display');

        if(display=='block'){
            $('.left-content ').css('display','none');
            $('.left-content ').css('width','0');
            $('.right-content ').css('width','100%');

        }else{
            $('.right-content ').css('width','84%');
            $('.left-content ').css('width','16%');
            $('.left-content ').css('display','block');


        }


    });

    //消息更多
    $('#mesRemain-more').click(function(){
        var layoutId = $(this).parent().parent().attr('id');
        var url = $(this).parent().parent().attr('data-interface');
        $('#iframeModal').attr('data-layoutId',layoutId);
        $('#iframeModal').attr('data-interface',url);
        $('#iframeModal').attr('src','messageList');
        $('#myModal .modal-header .modal-title').html('预警信息');

        $('#myModal').modal();
    });

    //文章更多
    $('#notice-more').click(function(){

        //频道layoutID
        var layoutId = $(this).parent().parent().attr('id');
        var url = $(this).parent().parent().attr('data-interface');
        $('#iframeModal').attr('data-layoutId',layoutId);
        $('#iframeModal').attr('data-interface',url);
        $('#iframeModal').attr('src','articleList');
        $('#myModal .modal-header .modal-title').html('通知公告');
        $('#myModal').modal();
    });


    //文章详细
    $('.notice ul li ').click(function(){
        window.open('articleDetail');
    });

})




//链接打开方式
function openURl(url){

    if(url==''|| url==null|| url==undefined ){
        return;
    }

    if(url.indexOf('http://')==-1 ){
        url='http://'+url;
    }

    if(url.indexOf('http://')==-1 ){
        url='http://'+url;
    }
    //判断当是F3系统页面时处理公共applet
    if(url.indexOf('f3portal') !=-1){
        $('#layoutHtml').html('');
        var html = '<iframe id="iframeModal" data-url ="'+url+'" style="overflow-y: hidden;overflow-x: hidden; height:100%;" src="'+url+'"   width="100%" height="100%" frameborder="0" data-id=""></iframe>';
        $('#right-content').html(html);
    }else{
        window.open (url, '_blank', 'width=' + screen.width + ',height=' + window.screen.availHeight + ', top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');

    }

};